package com.gateway.common.dto.route;

import java.util.Map;

/**
 * @program: ahcloud-gateway
 * @description:
 * @author: YuKai Fan
 * @create: 2023/2/21 23:20
 **/
public class FilterDefinitionDTO {

    /**
     * 过滤器名称
     */
    private String name;

    /**
     * 参数
     */
    private Map<String, String> args;

    /**
     * 处理器
     */
    private String handle;


    /**
     * 是否可操作
     */
    private Boolean actionable;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Map<String, String> getArgs() {
        return args;
    }

    public void setArgs(Map<String, String> args) {
        this.args = args;
    }

    public String getHandle() {
        return handle;
    }

    public void setHandle(String handle) {
        this.handle = handle;
    }

    public Boolean getActionable() {
        return actionable;
    }

    public void setActionable(Boolean actionable) {
        this.actionable = actionable;
    }

    public static final class Builder {
        private String name;
        private Map<String, String> args;
        private String handle;
        private Boolean actionable;

        private Builder() {
        }

        public static Builder builder() {
            return new Builder();
        }

        public Builder name(String name) {
            this.name = name;
            return this;
        }

        public Builder args(Map<String, String> args) {
            this.args = args;
            return this;
        }

        public Builder handle(String handle) {
            this.handle = handle;
            return this;
        }

        public Builder actionable(Boolean actionable) {
            this.actionable = actionable;
            return this;
        }

        public FilterDefinitionDTO build() {
            FilterDefinitionDTO filterDefinitionDTO = new FilterDefinitionDTO();
            filterDefinitionDTO.setName(name);
            filterDefinitionDTO.setArgs(args);
            filterDefinitionDTO.setHandle(handle);
            filterDefinitionDTO.setActionable(actionable);
            return filterDefinitionDTO;
        }
    }
}
